#include "StdAfx.h"
#include "WindowSynopsis.h"
#include "QueueBuffer.h"


WindowSynopsis::WindowSynopsis()
{
	this->buffer.reset(new QueueBuffer());
}


WindowSynopsis::~WindowSynopsis(void)
{
}
void WindowSynopsis::insertElement(Element& element)
{
#ifdef DEBUG
	std::cout<<"@@@@@@@@window synopsis begin@@@@@@@@@@"<<std::endl;
	std::cout<<"insert element : "<<element<<std::endl;
#endif
	this->buffer->enqueue(element);
#ifdef DEBUG
	std::cout<<"@@@@@@@@window synopsis end@@@@@@@@@@"<<std::endl;
#endif
}

void WindowSynopsis::deleteOldestElement(void)
{
#ifdef DEBUG
	std::cout<<"@@@@@@@@window synopsis begin@@@@@@@@@@"<<std::endl;
	std::cout<<"delete oldest element"<<std::endl;
#endif
	this->buffer->dequeue();
#ifdef DEBUG
	std::cout<<"@@@@@@@@window synopsis end@@@@@@@@@@"<<std::endl;
#endif
}
void WindowSynopsis::getOldestElement(Element& element)
{
#ifdef DEBUG
	std::cout<<"@@@@@@@@window synopsis begin@@@@@@@@@@"<<std::endl;
#endif
	this->buffer->peek(element);
#ifdef DEBUG
	std::cout<<"pick element : "<<element<<std::endl;
	std::cout<<"@@@@@@@@window synopsis end@@@@@@@@@@"<<std::endl;
#endif
}
bool WindowSynopsis::isFull(void)
{
#ifdef DEBUG
	std::cout<<"@@@@@@@@window synopsis begin@@@@@@@@@@"<<std::endl;
#endif
	bool bl =  this->buffer->isFull();
#ifdef DEBUG
	if(bl== true)
	{
		std::cout<<"the synopsis is full"<<std::endl;
	}
	else
	{
		std::cout<<"the synopsis is not full"<<std::endl;
	}
	std::cout<<"@@@@@@@@window synopsis end@@@@@@@@@@"<<std::endl;
#endif
	return bl;
}
bool WindowSynopsis::isEmpty(void)
{
#ifdef DEBUG
	std::cout<<"@@@@@@@@window synopsis begin@@@@@@@@@@"<<std::endl;
#endif
	bool bl =  this->buffer->isEmpty();
#ifdef DEBUG
	if(bl== true)
	{
		std::cout<<"the synopsis is empty"<<std::endl;
	}
	else
	{
		std::cout<<"the synopsis is not empty"<<std::endl;
	}
	std::cout<<"@@@@@@@@window synopsis end@@@@@@@@@@"<<std::endl;
#endif
	return bl;
}